<template>
  <div class="situation-header">
    <div class="situation-header-bg">
      <span></span>
      <span></span>
      <span></span>
    </div>
    <div class="top">
      <div class="left">
        <ty-weather />
        <el-breadcrumb class="ty-breadcrumb">
          <el-breadcrumb-item v-for="item in locality" :key="item.name" :to="{ path: item.path }">{{
            item.name
          }}</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <div class="middle">
        <div>
          <div class="title">{{ title }}</div>
        </div>
        <div class="center-animation-box"></div>
      </div>
      <div class="right k-flex">
        <div class="role">
          <img src="@/assets/imgs/role.svg" />
          <!-- <span class="text">{{ 张三 }}</span> -->
          <span class="text">{{ userInfo.nickName }}</span>
        </div>
        <div class="logout" @click="logout">退出</div>
      </div>
    </div>
  </div>
</template>

<script>
import TyWeather from "@/components/TyWeather";
import router from "@/router";
export default {
  name: "SituationHeader",
  components: { TyWeather },
  props: {
    title: {
      type: String,
      default: "0618ddd",
    },
  },
  data() {
    return {
      userInfo: "admin",
      locality: [],
    };
  },
  created() {
    this.routerInit();
  },
  methods: {
    logout() {},
    routerInit() {
      this.locality = router.options.routes ?? [];
    },
  },
};
</script>

<style lang="scss">
@keyframes fadeInHeader {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, -100%, 0);
    transform: translate3d(0, -100%, 0);
  }
  to {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

@keyframes linear-move {
  0% {
    transform: translateX(-50%);
    opacity: 0;
  }
  16% {
    transform: translateX(0);
    opacity: 1;
  }
  32% {
    transform: translateX(50%);
    opacity: 0;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

.situation-header {
  position: relative;
  width: 100%;
  background-size: 100% 100%;
  padding-bottom: 10px;
  animation-duration: 1s;
  animation-delay: 0.1s;
  animation-name: fadeInHeader;
  .situation-header-bg {
    display: flex;
    justify-content: center;
    flex-direction: row;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    /*background-color: red;*/
    height: 41px;
    background: linear-gradient(180deg, #071253 10%, #1f2c6f 89%);
    span {
      flex: 1;
      /*background: rgba(0, 18, 36, 0.85);*/
      height: 62px;
      pointer-events: none;
    }
    span:nth-child(2) {
      min-width: 1920px;
      background: url("../assets/imgs/header-bg.png") no-repeat;
      background-size: 100%;
      position: relative;
      text-align: center;
      width: 1920px;
      height: 86px;
    }
  }

  .top {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
  }
  .left,
  .right {
    flex: 1;
    display: flex;
    align-items: center;
    height: 64px;
  }
  .left {
    .ty-breadcrumb {
      .el-breadcrumb__item {
        color: white;
        padding: 0 20px;
        font-size: 20px;
      }
    }
  }
  .right {
    justify-content: flex-end;
    font-size: 14px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    color: #74f4ff;
    position: relative;
    top: -6px;
    .danger-switch-container {
      display: flex;
      align-items: center;
      .switch-label {
        color: rgba(#e2f5fd, 0.7);
        margin-left: 8px;
      }
    }
    .role {
      display: flex;
      align-items: center;
      justify-content: center;
      img {
        width: 18px;
        height: 18px;
      }
      .text {
        margin-left: 10px;
      }
    }
    .logout {
      margin-left: 20px;
      margin-right: 25px;
      cursor: pointer;
    }
  }
  .middle {
    text-align: center;
    padding-top: 8px;
    .title {
      /*background: linear-gradient(180deg, #fcfeff 0%, #80ddff 100%);*/
      /*-webkit-background-clip: text;*/
      /*-webkit-text-fill-color: transparent;*/
      margin-bottom: 2px;
      font-size: 40px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 600;
      color: #ffffff;
      line-height: 56px;
      letter-spacing: 2px;
    }
    .sub-title {
      font-size: 16px;
      font-weight: 500;
      color: #9de5ff;
      line-height: 16px;
    }
    .center-animation-box {
      position: absolute;
      bottom: -48px;
      left: 50%;
      transform: translateX(-50%);
      display: inline-block;
      width: 700px;
      height: 69px;
      overflow: hidden;
      &::after {
        position: absolute;
        top: 0;
        left: 0;
        transform: translateX(-50%);
        content: "";
        width: 100%;
        height: 100%;
        background: url("../assets/imgs/topheader-menu__content-light.png") no-repeat center center;
        background-size: 320px 138px;
        animation: linear-move 4.5s linear infinite;
      }
    }
  }
  .nav {
    position: absolute;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
    bottom: -32px;
    width: 300px;
    height: 34px;
    background: url("../assets/imgs/nav-bg.svg") no-repeat;
    background-size: 100% 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 32px;
    box-sizing: border-box;
    span {
      font-size: 16px;
      font-weight: 500;
      color: #e2f5fd;
      line-height: 28px;
      transition: all 0.2s ease-out;
      cursor: pointer;
    }
  }
}
</style>
